package org.ws.task.builder;

import org.ws.task.common.IndexNumberUtils;
import org.ws.task.model.protocol.base.RequestAction;
import org.ws.task.model.protocol.base.RequestMessage;

public class RequestMessageBuilder {
    private RequestMessage requestMessage;

    public RequestMessageBuilder() {
        this.requestMessage = new RequestMessage(IndexNumberUtils.getRequestMessageId());
    }

    public static RequestMessageBuilder builder(){
        return new RequestMessageBuilder();
    }

    public RequestMessageBuilder action(RequestAction action){
        this.requestMessage.setAction(action.getCode());
        return this;
    }

    public RequestMessageBuilder body(Object body){
        this.requestMessage.setBodyObject(body);
        return this;
    }

    public RequestMessage build(){
        return this.requestMessage;
    }

}
